/* globals homeTemplate aboutTemplate sections */
// var PouchDB = require('pouchdb') // uncomment if you come to need a database
var marked = require('marked')
var director = require('director')
var $ = require('jquery')

// ROUTES

var router = new director.Router()

router.on('/', homeController)
router.on('/home', homeController)
router.on('/about', aboutController)
router.configure({
  notfound: homeController
})

// CONTROLLERS

function homeController () {
  var html = homeTemplate({
    title: sections.home.title,
    body: marked(sections.home.body)
  })
  $('.app').html(html)
}

function aboutController () {
  var html = aboutTemplate({
    title: sections.about.title,
    body: marked(sections.about.body)
  })
  $('.app').html(html)
}

// MODELS

// START

$(function () {
  homeController() // start on, and default to, the home page
  router.init()
})
